﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.SYS.Library;
using ZX.BLL;
using ZX.Web.UI.Controls.ControlBind;
using ZX.Web.UI.Controls;

namespace ZX.WebApp.EditWidows.OrganizationalManager
{
    public partial class EditDuty : EditUIPage
    {
        BDatPhraseDetail bllDetail = new BDatPhraseDetail();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bindType();
            }       
        }
       /// <summary>
       /// 绑定职务类别
       /// </summary>
        private void bindType()
        {
            IList<DatPhraseDetail> listRelation = bllDetail.GetDatPhraseDetailByClassValue("DutyInfoType");
            DropDownListControl.DropDataSourceBind(this.ddlDutyType, listRelation, "PhraseText", "PhraseID");
            ddlDutyType.SelectedValue = this.GetStringFromQueryString("vType","");
            bindDuty(this.GetStringFromQueryString("vType", ""));
            ddlDuty.SelectedValue = this.GetStringFromQueryString("vDuty", "");
        }

        protected void ddlDutyType_SelectedIndexChanged(object sender, EventArgs e)
        {
            bindDuty(ddlDutyType.SelectedValue);
        }
        /// <summary>
        /// 根据职务类别绑定职务列表
        /// </summary>
        private void bindDuty(string vType)
        {
            ddlDuty.Items.Clear();
            ddlDuty.DataSource = bllDetail.GetDatDutyById(vType == "" ? Guid.Empty : new Guid(vType));
            ddlDuty.DataTextField = "Name";
            ddlDuty.DataValueField = "Id";
            ddlDuty.DataBind();
        }
        public string PostID
        {
            get { return this.GetStringFromQueryString("id",""); }
        }
        public string EntityNames
        {
            get { return this.GetStringFromQueryString("entity", ""); }
        }
    }
}